package com.skyjoo.search.lucene.utils;

import java.io.File;
import java.io.IOException;

public class FileUitls {

    public static File createDirIfNotExists(File parent, String child) {

        File file = new File(parent, child);
        if (!file.exists()) {
            file.mkdirs();
        }

        return file;
    }

    public static File createFileIfNotExists(File parent, String child) {

        File file = new File(parent, child);
        if (!file.exists()) {
            try {
                file.createNewFile();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return file;
    }

}
